Custom sharding routes points by an explicit shard key, enabling tenant co-location
Custom sharding lets you choose the key that determines which shard a point goes to, instead of letting Qdrant hash the point ID. You declare shard keys (typically tenant IDs, regions, or index names) when you create or extend the collection, and each point carries a shard key that tells the cluster which shard it belongs to. The practical effect is that all points for a given tenant land on the same shard, and a query scoped to that tenant can be routed to that single shard rather than fanning out to every shard in the cluster. In a multitenant system, this is the difference between a query touching one shard and a query touching all of them, which is a large latency and cost difference at scale.
The mechanism relies on two things: the shard key must be known at write time (it is part of the upsert request), and the query must specify the same shard key to benefit from routing. If either is missing, the operation falls back to fan-out. Custom sharding also gives you control over data placement, which matters for isolation: you can put a large tenant on its own shard to prevent it from affecting others, or you can group small tenants onto a shared shard to avoid creating thousands of tiny shards. The trade-off is that the distribution is now your responsibility. If tenants are unevenly sized, some shards will be much larger than others, and a single hot tenant can dominate a node. You also lose the automatic even distribution that hash sharding provides. In practice, the right shard key is medium-cardinality: tenant ID or region works well; user ID or document ID does not, because it creates far too many shards. Cross-tenant queries - rare in most multitenant systems but real in some - become expensive because they have to fan out to all shards.
Shard key is chosen by you, not hashed from the point ID. Typical keys: tenant_id, region, index_name.
Points carry the shard key; queries specify it to get single-shard routing.
Co-location: all data for a key lives on one shard, so scoped queries avoid fan-out.
Isolation: large tenants can be placed on dedicated shards; small tenants can be grouped.
Cardinality matters: too many shard keys creates thousands of tiny shards; too few loses the routing benefit.
Cross-key queries still fan out; custom sharding optimizes for scoped access, not global search.
The trade-off is query routing and isolation against even distribution and operational simplicity. Custom sharding is clearly the right choice for multitenant systems where most queries are tenant-scoped, which is the common case. It is the wrong choice when queries are inherently global - for example, a single search index that everyone queries without a tenant filter - because then every query fans out anyway and you have given up the even distribution for nothing. The common mistake is choosing a shard key with too high a cardinality, like user ID, which creates a shard per user and destroys the benefit while creating enormous operational overhead. The second mistake is forgetting that a query without the shard key still fans out - the routing benefit only exists if the client actually specifies the key. The third mistake is not planning for tenant growth: a shard key that starts as a small tenant can grow into a hot shard, and you need a strategy (dedicated shard, rebalancing) before that happens. Version note: sharding_method and the shard key API are relatively recent additions and have changed across releases - the exact way to create a shard key, the supported key types, and the query syntax for selecting a shard have all evolved.
Version-dependent: the sharding_method enum, create_shard_key, and the shard_key_selector parameter on upsert and query are part of a relatively recent Qdrant API. Earlier versions supported only hash-based sharding, or exposed custom routing through a different mechanism. The supported shard key types (keyword versus integer) and the way a query selects a shard have also changed. If you are designing a multitenant system around custom sharding, verify the API on your version and plan for the fact that adding a shard key is not the same as rebalancing existing data - existing points keep their placement, so a key change usually means a migration.
You have a multitenant collection with custom sharding and you run a query without specifying the shard key. Explain what happens and why it is slower.
A teammate wants to use user_id as the shard key. Explain why that is a bad idea and suggest a better key.
You have 500 tenants, most with under 10k vectors and a few with over 10M. Design a shard key strategy that avoids creating 500 tiny shards without letting the large tenants dominate.
Your custom-sharded collection has one shard that is 10x larger than the others. Diagnose how this happened and propose a rebalancing approach.
Design a multitenant architecture on Qdrant for 10,000 tenants with strict data isolation and per-tenant latency SLAs. How do you use custom sharding, replication, and consistency to meet the requirements?
You need to support both tenant-scoped queries and a global admin query that searches across all tenants. Describe how custom sharding affects each and what you would do to keep the admin query fast.
Derive a shard key assignment strategy that minimizes the maximum shard size across a set of tenants with a heavy-tailed size distribution, and explain the failure mode if your estimate of tenant sizes is wrong.
You are migrating a single-tenant collection to a multi-tenant custom-sharded collection with zero downtime. Describe the migration, the dual-write or backfill strategy, and how you validate that routing is correct before cutover.